home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / comm / irc / Online-O-Meter.lha / O-O-Meter.amirx next >
Text File  |  1999-02-21  |  2KB  |  28 lines

  1. /*
  2.     Online-O-Meter Version 1.01
  3.     Compilation Date: 21-Feb-1999.
  4.     © 1999 Frank Meyer-Pfauder.
  5. */
  6.  
  7. file="Programs:Net/Dial/DialLog.txt"
  8.  
  9. ADDRESS(AMIRC.1);CALL output("Online-O-Meter - Retrieving online data...");IF ~EXISTS(file) THEN DO
  10. CALL output("Oh no... specified Miami log file could not be found.");EXIT;END;prevline="";actline=""
  11. IF OPEN(log,file,'R') THEN DO;DO WHILE ~EOF(log);prevline=actline;actline=readln(log)
  12. IF FIND(actline,'Online:')>0 THEN lastonline=actline;END;CLOSE(log);END;ELSE DO
  13. CALL output("Arrgh... log file could not be opened... maybe read protected ?");EXIT;END
  14. IF FIND(prevline,'Online:')>0 | FIND(prevline,'Reconnect:')>0 THEN DO
  15. IF FIND(prevline,'Reconnect:')>0 THEN prevline=lastonline;logtime=subword(prevline,3,1)
  16. ologday=subword(prevline,2,1);logday=substr(ologday,7,4)||substr(ologday,4,2)||substr(ologday,1,2)
  17. day=date('W',logday,'S')
  18. CALL output("You have been online since "substr(logtime,1,5)" h, "day" "ologday".")
  19. logtot=date('B',logday,'S')+(convsecs(logtime)/86400);actdate=date('S');acttime=time('N')
  20. acttot=date('B',date('S'),'S')+(convsecs(acttime)/86400);ontime=(acttot-logtot)
  21. ondays=(substr(ontime,1,pos('.',ontime)-1));onhours=(substr(ontime,pos('.',ontime)))*24
  22. onmins=(substr(onhours,pos('.',onhours)))*60;onhours=(substr(onhours,1,pos('.',onhours)-1))
  23. onmins=(substr(onmins,1,pos('.',onmins)-1))
  24. CALL output(d2c(2)"You have been online for "ondays" day(s), "onhours" hour(s) and "onmins" minute(s).")
  25. END;ELSE DO;CALL output("Sorry... you don't seem to be online right now...");EXIT;END;EXIT;output:
  26. parse arg text;"echo C=1 P="d2c(27)"b«O-O-Meter» "text;RETURN;convsecs:;parse arg otime
  27. hour=substr(otime,1,2);min=substr(otime,4,2);sec=substr(otime,7,2);min=(hour*60)+min;sec=(min*60)+sec
  28. RETURN sec